package com.chenlei.serviceImpl;



import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chenlei.dao.UserMapper;
import com.chenlei.model.User;
import com.chenlei.model.UserExample;
import com.chenlei.service.LoginService;
@Service
public class LoginServiceImpl implements LoginService{
	@Autowired
	UserMapper userMapper;
	@Override
	public boolean loginSuccess(String phoneNum, String passwd,HttpSession session) {
		// TODO Auto-generated method stub
		UserExample ue=new UserExample();
		//ue.createCriteria().andMobileNoEqualTo(Integer.parseInt(phoneNum));
		ue.createCriteria().andUserNameEqualTo(phoneNum);
		List<User> userList=userMapper.selectByExample(ue);
		if(userList.size()!=0){
			User u=userList.get(0);
			if(u.getPassword().equals(passwd)){
				
				return true;
			}
		}
		
		return false;
	}

}
